package com.bbms.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.bbms.dao.PublisherDAO;
import com.bbms.entity.Page;
import com.bbms.entity.Publisher;
import com.bbms.service.PublisherService;

/**
 * @author Administrator
 * 出版社业务管理实现类
 */
@Service("PublisherServiceImpl")
public class PublisherServiceImpl implements PublisherService {
	
	@Resource(name="PublisherDAOImpl")
	PublisherDAO dao;
	
	/* 新增出版社业务
	 * @see com.bbms.service.BaseService#add(java.lang.Object)
	 */
	@Override
	public void add(Publisher t) {
		dao.save(t);
	}

	/* 修改出版社业务
	 * @see com.bbms.service.BaseService#update(java.lang.Object)
	 */
	@Override
	public void update(Publisher t) {
		dao.update(t);
	}

	/* 删除出版社业务
	 * @see com.bbms.service.BaseService#delete(java.lang.Object)
	 */
	@Override
	public void delete(Publisher t) {
		dao.delete(t);
	}

	/* 获取分页数据业务
	 * @see com.bbms.service.BaseService#getPage(int, int)
	 */
	@Override
	public Page getPage(int currentPage, int pageSize) {
		Page page = dao.getPage(currentPage, pageSize);
		
		return page;
	}

	/* 获取所有出版社业务
	 * @see com.bbms.service.PublisherService#getAllData()
	 */
	@Override
	public Object getAllData() {

		Object o = JSONObject.toJSON(dao.query());
		
		return o;
	}

}
